import junit.framework.TestCase;


public class SecurityManagerTest extends TestCase 
{
    public void testUIDNULL()
    {
	SecurityManager test = new SecurityManager();
	test.addUser(new User("testuser", "testpass"));
	assertEquals(PasswordResponse.BAD_UID, 
		test.doLogin(null, null) );
	
    }
    
    public void testUIDNotExist()
    {
	SecurityManager test = new SecurityManager();
	test.addUser(new User("testuser", "testpass"));
	assertEquals(PasswordResponse.BAD_UID, 
		test.doLogin("IdunExist", "lolol") );
	
    }
    
    public void testBadPassword()
    {
	SecurityManager test = new SecurityManager();
	test.addUser(new User("testuser", "testpass"));
	assertEquals(PasswordResponse.BAD_PASSWORD, 
		test.doLogin("testuser", "lolol") );
    }
    
    public void testGoodPassword()
    {
	SecurityManager test = new SecurityManager();
	test.addUser(new User("testuser", "testpass"));
	assertEquals(PasswordResponse.GOOD_LOGIN, 
		test.doLogin("testuser", "testpass") );
    }
    
    public void testWithNullPassword()
    {
	SecurityManager test = new SecurityManager();
	test.addUser(new User(null, null));
	assertEquals(PasswordResponse.BAD_UID, 
		test.doLogin(null, null) );
    }
    
    public void testWithNullUser()
    {
	SecurityManager test = new SecurityManager();
	test.addUser(new User(null, null));
	assertEquals(PasswordResponse.BAD_UID, 
		test.doLogin(null, null) );
    }
    
    public void testWithNoUsers()
    {
	SecurityManager test = new SecurityManager();
	assertEquals(PasswordResponse.BAD_UID, 
		test.doLogin("nouser", "lol") );
    }
}
